<!-- 后台全部订单 -->
{% extends 'personalLayout.html' %}
{% load static %}
{% block title %}
    <title>全部订单</title>
{% endblock %}
{% block css %}
    <link rel="stylesheet" href="{% static 'css/orderStyles.css' %}">
{% endblock %}
{% block content %}
    <!-- 外层容器 -->
    {#    <div class="layout-div">#}
    <!-- 搜索框 -->
    <div class="title-search">
        <h2 style="margin-left:150px; font-weight:bold;"><i class="fa fa-address-card-o"></i>&nbsp;全部订单</h2>
        <div class="input_search_div">
            <label for="title"></label><select class="form-control my-select-area" id="title" name="title">
            <option>订单编号</option>
            <option>婚宴时间</option>
            <option>客户姓名</option>
            <option>金额</option>
            <option>联系电话</option>
            <option>订单状态</option>
            <option>员工编号</option>
        </select>
            <label for="value"></label><input type="text" class="form-control search-input" id="value" name="value"
                                              placeholder="搜索">
            <div class="button-groups">
                <button type="button" class="btn btn-primary" id="all-search"><i class="fa fa-search"></i> 搜索
                </button>
                {% if result.page_flag != None %}
                    <btn id="refresh" class="btn btn-primary"><i class="fa fa-braille"></i> 显示全部</btn>
                    {#                <a href="/personal/search/result/?flag=${flag}" class="btn btn-primary"><i class="fa fa-braille"></i> 显示全部</a>#}
                {% endif %}
            </div>
        </div>
    </div>
    <!-- 订单详情 -->
    <div class="box_order">
        <table class="table">
            <thead>
            <tr class="table-info">
                <th># 订单编号</th>
                <th>婚宴时间</th>
                <th>客户姓名</th>
                <th>联系电话</th>
                <th>订单状态</th>
                <th>员工编号</th>
                <th>备注</th>
                <th style="width:250px;">操作</th>
            </tr>
            </thead>
            <tbody>
            {% for obj in result.order_manager %}
                <tr>
                    <th scope="row">{{ obj.orderId }}</th>
                    <td>{{ obj.marryTime }}</td>
                    <td>{{ obj.customer }}</td>
                    <td>{{ obj.c_phone }}</td>
                    <td>{{ obj.status }}</td>
                    <td>{{ obj.userId_id }}</td>
                    <td>{{ obj.note }}</td>
                    <td style="padding-right: 5px">
                        <div class="update">
                            <a class="btn btn-primary" data-order_id="{{ obj.orderId }}"
                               data-user_id="{{ obj.userId }}"
                               data-marry_time="{{ obj.marryTime }}"
                               data-phone="{{ obj.phone }}"
                               data-customer="{{ obj.customer }}"
                               data-c_phone="{{ obj.c_phone }}"
                               data-c_other="{{ obj.c_other }}"
                               data-prize="{{ obj.prize }}"
                               data-status="{{ obj.status }}"
                               data-note="{{ obj.note }}"
                               data-toggle="modal"
                               data-target="#myModal-update"><i class="fa fa-edit"></i> 修改</a>
                            <a class="btn btn-info" href='/personal/order/{{ obj.orderId }}/detail/update/'><i
                                    class="fa fa-info-circle"></i> 详情</a>
                            <button data-order-id="{{ obj.orderId }}" class="btn btn-danger"><i
                                    class="fa fa-trash"></i>
                                删除
                            </button>
                        </div>
                    </td>
                </tr>
            {% endfor %}
            </tbody>
        </table>
    </div>
    <!-- 分页 -->
    <div class="my-page-div">
        {{ result.div }}
        <ul class="pagination page">
            {% for li in result.page_list %}
                {{ li }}
            {% endfor %}
        </ul>
    </div>
    {#    </div>#}
{% endblock %}
{% block other %}
    <!-- 更新模态框 -->
    <div class="modal fade" id="myModal-update" tabindex="-1" aria-labelledby="myModalLabel_update" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="myModal_updateLabel">修改订单</h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <form id="order-manage-update-form" method="post">
                        {% csrf_token %}
                        {% for field in form %}
                            <div class="form-group" style="width:80%;">
                                <label>{{ field.label }}</label>
                                {{ field }}
                                <span style="color: red">{{ field.errors.0 }}</span>
                            </div>
                        {% endfor %}
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" data-order-Id="{{ result.order_id }}" class="btn btn-default"
                            data-dismiss="modal">关闭
                    </button>
                    <button type="button" class="btn btn-primary" id="submit-update">确认修改</button>
                </div>
            </div>
        </div>
    </div>
{% endblock %}

{#Coding you Js#}
{% block js %}
    <script src="{% static 'js/orderAdd.js' %}"></script>
{% endblock %}
